<?php
echo $this->headLink()->prependStylesheet($this->baseUrl().'/css/order_enquiry.css');
echo $this->headLink()->prependStylesheet($this->baseUrl().'/css/datatables/demo_page.css');
echo $this->headLink()->prependStylesheet($this->baseUrl().'/css/datatables/demo_table_jui.css');
echo $this->headLink()->prependStylesheet($this->baseUrl().'/css/datatables/demo_table.css');
echo $this->headLink()->prependStylesheet($this->baseUrl().'/css/ui-darkness/jquery-ui-1.8.16.custom.css');
echo $this->headScript()->appendFile($this->baseUrl().'/js/jquery-1.6.2.min.js');
echo $this->headScript()->appendFile($this->baseUrl().'/js/jquery-ui-1.8.16.custom.min.js');
echo $this->headScript()->appendFile($this->baseUrl().'/js/datatables/jquery.dataTables.min.js');

?>
<script type="text/javascript">
$(document).ready(function(){
	$('#table').dataTable( {
		"bJQueryUI": true
	});
});
</script>
<script type="text/javascript">
$(function() {
	$("#dialog:ui-dialog").dialog("destroy");

	$("#dialog-message").dialog({
		modal: true,
		buttons: {
			OK: function() {
				$(this).dialog("close");
			}
		}
	});
});
</script>
<?php
$this->title = "Order Enquiry";
$this->headTitle($this->title);
?>
<h1><a href="<?php echo $this->url(array('controller'=>'index', 'action'=>'index'), null, true); ?>">Home</a> > <?php echo $this->escape($this->title); ?></h1>
<div class="cont">
<?php echo $this->form; ?>
<div class="gap"></div>
<?php
if(isset($this->checker)){
	if($this->checker == true) {
?>
		<div id="dialog-message" title="Search ERROR">
			<p>Please type Order Number or Customer Number.</p>
			<p>Please try again</p>
		</div>
<?php
	}
}
?>
<div class="table">
<table id="table">
<thead>
<tr>
	<th>Order No</th>
	<th>Order Date</th>
	<th>Staff Number</th>
	<th>Customer Number</th>
	<th>Order Status</th>
	<th>Order Price</th>
	<th>&nbsp;</th>
</tr>
</thead>
<tbody>
<?php foreach($this->orders as $order) : ?>
<tr>
	<td><a href="<?php echo $this->url(array('controller'=>'order', 'action'=>'edit', 'order_no'=>$order->order_no, 'cust_no'=>$order->cust_no, 'staff_no'=>$order->staff_no), null, true)?>"><?php echo $this->escape($order->order_no); ?></a></td>
	<td><?php echo $this->escape($order->order_date); ?></td>
	<td><?php echo $this->escape($order->staff_no); ?></td>
	<td><?php echo $this->escape($order->cust_no); ?></td>
	<td><?php echo $this->escape($order->order_status); ?></td>
	<td><?php echo $this->escape($order->order_price); ?></td>
	<td><a href="<?php echo $this->url(array('controller'=>'order', 'action'=>'cancel', 'order_no'=>$order->order_no, 'order_status'=>$order->order_status))?>">Cancel</a></td>
</tr>
<?php endforeach;?>
</tbody>
</table>
</div>
</div>
